Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ID problem in Firefox 1

Status
Not open for further replies.

kylua

Technical User
Joined
Sep 30, 2002
Messages
199
Location
GB
Hi

I'm trying to use divs to alter text on a screen dynamically. (Textarea limited to 160 characters and I want to show how many left every time something is typed in the box.) Now this works fine in IE but doesn't in Firefox.
The reason? Becos Firefox inserts a space into the id of the div:
<div name = "ozi" > becomes <div name = " ozi" > and that is impossible to reference. Same if you use 'id = "ozi"'
I've seen that another website, that has the same function also doesn't work in Firefox.
Any suggestions on how to get round this?

Many Thanks

Colin
 
i've never ever seen firefox insert a space. if it's giving you an error, or if you're trying to use a validation, it may just be doing that to make it easy for you to see where the error is.

we'll need to see some code and/or the error you're receiving.

*cLFlaVA
----------------------------
[tt]insert funny quotation here.[/tt]
 
There's no error, it just doesn't do anything.
The code that is the html file that I have uploaded is:
<div id ="o">Max 160 characters. 160 left</div>
And the code that I get viewing source in Firefox is:
<div id =" o">Max 160 characters. 160 left</div>
The source is unchanged in IE.

I have tried using more than 1 character names and that made no difference, "ozi" changed to " ozi"

Unfortunately, it makes it reject the entire sub which does limit the size of the entry.
 
Can we see an online example of this? How are you producing the html code -- is it created dynamically from a server-side language? I have used id numberous times in Mozilla and FF and never have I seen such a behaviour.
 
In one case, part of it is generated serverside, in another case it is simple html.
If you go to:

You can see the work in progress of this. It is referring to the 'confirmation message' at the bottom of the form.
(While you're there, you can see why the 'Level of filtration' dynamic text doesn't work even in IE cos but that may be something simple as I haven't even looked since it stopped working for no apparent reason.)
 
I just did a View > Source on that page in FF 1.0PR and then searched for "id=". I looped through the entire page and did not find one instance of id=" blah".

*cLFlaVA
----------------------------
[tt]insert funny quotation here.[/tt]
 
i am getting an error "textcount is not defined". textcount appears to be a vbscript sub defined, and therefore i'm not really sure what to tell you...

*cLFlaVA
----------------------------
[tt]insert funny quotation here.[/tt]
 
ahh, i see the id problem now. is that section of html being generated dynamically, as vragabond asked?

*cLFlaVA
----------------------------
[tt]insert funny quotation here.[/tt]
 
Textcount is the sub name. Just done some mucking about and it is simply not running the sub no matter what is in it.
'onkeyup = textcount()' or 'onkeyup = "textcount()"' work fine in IE but not in Firefox.

It is a pure .htm page.
 
I think that leading space may be a bug in the FF source code viewer, the code actually says
Code:
id= "o"
If you take the space between the = and the " out, the source code viewer shows the value properly.

The script still doesn't work, though. I think the reason is this:
Code:
<script language="vbscript">
From the Firefox FAQ:
There is no support for VBScript and ActiveX [in Firefox], two technologies which are the reasons for many IE security holes.
I don't know how much support there is for VBScript in other non-Microsoft browsers, not much I expect. Recode the character counter (and other VBScript stuff) into Javascript (and put it in the <head> section where it belongs while you're at it) and your cross-browser compatibility should improve no end.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Thanks Chris.

Not the answer I was wanting but what the hell, I'll just have to learn Javascript.
 
I don't speak much Javascript myself either, but you don't have to when you're doing commonplace stuff like forms validation. A little Googling should turn up plenty of pre-written scripts that will do the job for you. Try the Javascript Source's forms scripts page for a start.

If you want to learn something, learn some CSS - you can get rid of all those manky <font> tags and some of your mouseover event checks too!

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
I used the jscript verification feature in Frontpage and it destroyed the functionality of vbscript.
For the moment, I'm going to put a 'Your browser is non vbscript compatible' warning on which I use vbscript to take off and the counter simply won't appear unless the browser is vb enabled. I'll learn Javascript etc after the site's up to amend it to make it friendlier to those awkward people, (like me), who prefer not to use ie.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top