This is a discussion on "string capacity" within the JavaScript Forum section. This forum, and the thread "string capacity are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
string capacity
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
string capacity
Hi, I have a small Javavscript function which recieves some text and a table cell ID (both PHP variables). On mouseover the text is displayed in the specified cell. This is ok if the length of the text string isn't too long but over a certain length the text isn't displayed. How do i specify the length of the string the Javascript can handle?
My function is:- function display(text,cell){ var getText = document.getElementById(cell).innerHTML += text; } Thanks Don |
|
|
|
|||
|
Re: string capacity
There seems to be a bit of confusion here when you say the function receives two parameters that are php variables. JavaScript happens client-side and php happens server-side. Where does the text originate from whose length you want to control. You should be aware of a cross browser problem with the way you are doing things. It's my understanding that Firefox has a problem with innerHTML when it comes to table cells. |
|
|||
|
Re: string capacity
Maybe I should have included this line of PHP which calls the function with the php variables $text and $cellID.
echo "<a href='$location' onmouseover='display(\"$text", \"$cellID\")'>$link</a>"; Here's the function again: - function display(text,cell){ var getText = document.getElementById(cell).innerHTML += text; } The code works apart from the described string length problem. Thanks Don |
|
||||
|
Re: string capacity
Hmm. That's odd, I don't think there's a max string length. How long are these strings?
|
|
|||
|
Re: string capacity
The cut off point seems to be approx 100 characters.
|
|
|||
|
Re: string capacity
Could you echo the text produced by the php code to the screen seperately so we can tell whether its php or on the html page where the text is being abreviated.
|
|
||||
|
Re: string capacity
Which browser(s) are you testing in? As Geoff said, it could be a browser thing.
|
|
|||
|
Re: string capacity
Not sure what you mean by echoing to the screen but here's what's echoed. I'm using Firefox.
echo "<td width ='50%' >\n"; echo "<a href='$location' onmouseover='display(\"$text", \"$cellID\")'>$link</a>"; echo "</td></tr>\n"; echo "<td width='50%' id = '$cellID'></td></tr>\n"; |
|
|||
|
Re: string capacity
Just for debug purposes, add this line of code and then you will be able to read the value on screen. Depending where in your php you put it it might displace your layout but that's the price of debugging.
|
|
|||
|
Re: string capacity
I put 'print ("<b />".$text."<b />"); ' before the table, in the table and after the table, each time the full string shows. Thanks for your help so far by the way, much appreciated.
|
|
|||
|
Re: string capacity
Ok, so we know that php isn't cutting your string short so it's happening client-side. I'd like you to try a different browser and see if the same thing happens. |
![]() |
| Tags |
| string, capacity |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| timestamp in string to int | CloudedVision | PHP Forum | 1 | Apr 3rd, 2008 17:10 |
| Get value from SQL string ? | VegaLA | Classic ASP | 5 | Jan 30th, 2008 07:39 |
| capacity of a div. asp.net | shamail | ASP.NET Forum | 0 | Aug 20th, 2007 20:59 |
| website capacity? | cj550 | Hosting & Domains | 4 | Mar 18th, 2007 19:01 |
| append % to the string | chandra.nowduri | ASP.NET Forum | 1 | Aug 9th, 2006 09:47 |