[thelist] [JS] trying to do a bookmarklet and failing

liorean liorean at f2o.org
Fri May 28 09:05:37 CDT 2004


Tom Dell'Aringa wrote:
> I've been trying to build this little bookmarklet that resizes a
> textarea on a page. I've read some tutorials online but I can't get
> mine to work. Here's the deal. I have a textarea on the page:

If it's a bookmarklet I can probably help you... I've written a few.

> I want to click the bookmarklet and make the rows/cols like 40/100,
> so I tried:
> 
> <a href="javascript:document.formName.message.rows=40;
> document.formName.message.cols=100;">Adjust Box</a>
> 
> What happens there is I get a new page with the text '100' - so I
> figured I needed a 'return false;' at the end. Trying that gives me
> an 'invalid return' error.

Need the last statement in the javascript pseudouri to be a nonreturner...

> /- - -/ So lastly, I tried using the old void method:
> 
> <a href="javascript: void(document.formName.message.rows=40;
> document.formName.message.cols=100)">Adjust Box</a>
> 
> Yet I get 
> 
> Error: missing ) in parenthetical
> Source File: javascript: void(document.formName.message.rows=40;
> document.formName.message.cols=100)
> Line: 1, Column: 37
> Source Code:
>  void(document.formName.message.rows=40;
> document.vbform.message.cols=100)
> 
> I don't see where a parenthetical is missing at all. Any help is
> appreciated - this should be simple but nothing works.

The parentesis that is missing should be placed after the "...40;". Arguments only takes single expressions, not multiple statements. Alternatively you could more the void() part to only enclose the last expression in the line, or change the semicolon into a comma.


// David
-- 
David "liorean" Andersson

ViewStyles, ViewScripts, SwitchStyles and GraphicsInfo bookmarklets:
<http://liorean.web-graphics.com/>
Hangouts:
<http://codingforums.com/> <http://yourmusicforums.com/>


More information about the thelist mailing list