SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
-
May 5, 2007, 16:08 #1
- Join Date
- Aug 2000
- Location
- Philadephia, PA
- Posts
- 20,578
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
Error: missing name after . operator
JavaScript isn't my strong suit... I've tried writing this line 4 different ways, always getting the same error. How can I rewrite all the URLs inside an iframe to call a JavaScript function with the URL as an argument instead of go to their original destination?
Code:var clicks = []; function markMeUp(arr) { clicks = arr; frame = document.getElementById('overlay_frame'); var linkList; for (var i = 0; i < frame.contentDocument.links.length; i++) { link = frame.contentDocument.links[i]; if (link.href.indexOf('#', 0) > 0) { link.href = link.href.substring(0, link.href.indexOf('#', 0)); } iconify(frame, link); } for (var i = 0; i < frame.contentDocument.links.length; i++) { var tmp = frame.contentDocument.links[i].href; frame.contentDocument.links[i].href = "parent.overlay('" . escape(tmp) . "')"; } }
Code:Error: missing name after . operator Source File: http://localhost/js/overlay.js Line: 19, Column: 75 Source Code: frame.contentDocument.links[i].href = "parent.overlay('" . escape(tmp) . "')";
Try Improvely, your online marketing dashboard.
→ Conversion tracking, click fraud detection, A/B testing and more
-
May 5, 2007, 16:25 #2
- Join Date
- Sep 2005
- Location
- Sydney, NSW, Australia
- Posts
- 16,875
- Mentioned
- 25 Post(s)
- Tagged
- 1 Thread(s)
"parent.overlay('" . escape(tmp) . "')";
should be
"parent.overlay('" + escape(tmp) + "')";Stephen J Chapman
javascriptexample.net, Book Reviews, follow me on Twitter
HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
<input name="html5" type="text" required pattern="^$">
-
May 5, 2007, 16:27 #3
- Join Date
- Aug 2000
- Location
- Philadephia, PA
- Posts
- 20,578
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
Gah, how stupid of me. Thanks.
Try Improvely, your online marketing dashboard.
→ Conversion tracking, click fraud detection, A/B testing and more
-
May 6, 2007, 03:43 #4
- Join Date
- Apr 2007
- Posts
- 813
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
you must have a lot php influence
-
May 6, 2007, 04:02 #5
- Join Date
- Aug 2000
- Location
- Philadephia, PA
- Posts
- 20,578
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
Heck, that's just the beginning of it. I'm juggling 5 or 6 languages a day. C# and SQL Server's brand of SQL at work, some JScript there, come home and work on websites in both PHP and Perl, MySQL's version of SQL for those, and a Java app occasionally I'm trying to finish.
Try Improvely, your online marketing dashboard.
→ Conversion tracking, click fraud detection, A/B testing and more
-
May 29, 2007, 07:38 #6
- Join Date
- Feb 2006
- Posts
- 2
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks for this post. I did the same thing a second ago, using the Perl/PHP concat operator instead of the '+' in JS.
Bookmarks