Hi,
(--1--)
I'm trying to find a way to jump to a link (<a href="ref"></a>) in a
page
that is generated with javascript.
The source view of the page only shows the javascript methods.
The HTML is *not* visible in the source view.
Passing the "#ref" on the URL doesn't work.
Changing window.location to "ref" neither.
Is this actually possible?
(--2--)
The scrollTo(x,y) function with javascript generated HTML seems
also problematic with IE, not with Mozilla. Well I'm having probs
with scrollTo(x,y) on IE in all cases, even static HTML...
Thanks! 6 2921
wrote on 18 mrt 2006 in comp.lang.javas cript: Hi,
(--1--)
I'm trying to find a way to jump to a link (<a href="ref"></a>) in a page that is generated with javascript.
Do you mean:
<a name="ref"></a>
?
The source view of the page only shows the javascript methods. The HTML is *not* visible in the source view.
Not relevant, you probably can see the code with this:
javascript:aler t((document.doc umentElement||d ocument.body).i nnerHTML)
Passing the "#ref" on the URL doesn't work. Changing window.location to "ref" neither.
Is this actually possible?
What is "passing to"? Show us your code.
(--2--)
The scrollTo(x,y) function with javascript generated HTML seems also problematic with IE, not with Mozilla. Well I'm having probs with scrollTo(x,y) on IE in all cases, even static HTML...
Use body-onload, the page has to be ready first
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Thanks for the reply. Here's my code, the javascript is generated
from the PHP module TreeMenu.php:
======
<script language="javas cript" type="text/javascript">
objTreeMenu_1 = new TreeMenu("image s", "objTreeMenu_1" , "_self",
"treeMenuDefaul t", true, false);
newNode = objTreeMenu_1.a ddItem(new TreeNode('First level<a
href=ct></a>', 'folder.gif', null, true, true, '', '',
'folder-expanded.gif')) ;
newNode.setEven t('onexpand', 'alert(\'Expand ed\')');
newNode_1 = newNode.addItem (new TreeNode('Secon d level',
'folder.gif', 'test.php', false, true, '', '', 'folder-expanded.gif')) ;
newNode_1_1 = newNode_1.addIt em(new TreeNode('Third level',
'folder.gif', 'test.php', false, true, '', '', 'folder-expanded.gif')) ;
.......
objTreeMenu_1.d rawMenu();
objTreeMenu_1.w riteOutput();
objTreeMenu_1.r esetBranches();
</script>
=========
somewhere in the code you see <a href="ct"></a>.
I'd like to jump to that when the page is shown in the browser.
The page is printed as a treemenu. the drawmenu() function
corresponds to document.write( str).
The onload(window.l ocation("ct")) doesn't work. da********@gmai l.com wrote: somewhere in the code you see <a href="ct"></a>. I'd like to jump to that when the page is shown in the browser. The page is printed as a treemenu. the drawmenu() function corresponds to document.write( str).
The onload(window.l ocation("ct")) doesn't work.
You are confused about anchors and links.
<a href="ct"></a> is not an anchor, it's a link. You cannot navigate to
it by HTML means. In order to make it both link and anchor, you need to
give it a name:
<a href="somePage. html" name="ct">Link and Anchor</a>
Now you can refer to this place on your page as ...href="#ct".. .
And if your page is served anyway by PHP, it is easier to make
server-side redirect then, so the url would be changed from say
"siteMap.ht ml" to "siteMap.html#c t"
This way the "jump" will be done even with JavaScript disabled.
Thanks a lot. With this little bit of elementary knowledge you ended a
stretch of 3 day frustration.
wrote on 18 mrt 2006 in comp.lang.javas cript: Thanks for the reply.
Please quote what you are replying to.
This is NOT email!
If you want to post a followup via groups.google.c om, don't use the
"Reply" link at the bottom of the article. Click on "show options" at the
top of the article, then click on the "Reply" at the bottom of the
article headers. <http://www.safalra.com/special/googlegroupsrep ly/>
Here's my code, the javascript is generated from the PHP module TreeMenu.php:
====== <script language="javas cript" type="text/javascript">
language="javas cript" is no longer needed, leave it out!
objTreeMenu_1 = new TreeMenu("image s", "objTreeMenu_1" , "_self", "treeMenuDefaul t", true, false); newNode = objTreeMenu_1.a ddItem(new TreeNode('First level<a href=ct></a>', 'folder.gif', null, true, true, '', '', 'folder-expanded.gif')) ; newNode.setEven t('onexpand', 'alert(\'Expand ed\')'); newNode_1 = newNode.addItem (new TreeNode('Secon d level', 'folder.gif', 'test.php', false, true, '', '', 'folder-expanded.gif')) ; newNode_1_1 = newNode_1.addIt em(new TreeNode('Third level', 'folder.gif', 'test.php', false, true, '', '', 'folder-expanded.gif')) ;
.......
objTreeMenu_1.d rawMenu(); objTreeMenu_1.w riteOutput(); objTreeMenu_1.r esetBranches();
This is all based on a library you do not show, so we cannot comment on
that.
</script>
========= somewhere in the code you see <a href="ct"></a>. I'd like to jump to that when the page is shown in the browser.
You cannot, unless you give it a name, as I told you before.
The page is printed as a treemenu. the drawmenu() function corresponds to document.write( str).
The onload(window.l ocation("ct")) doesn't work.
elementary, my dear unnamed.
Please try to learn some javascript. This NG is not a helpdesk for
correcting machine generated script. That is like asking a translator for
corrections to a bad machine translation.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
VK wrote: da********@gmai l.com wrote: somewhere in the code you see <a href="ct"></a>. I'd like to jump to that when the page is shown in the browser. The page is printed as a treemenu. the drawmenu() function corresponds to document.write( str).
The onload(window.l ocation("ct")) doesn't work.
You are confused about anchors and links.
Nonsense. Will you ever get informed properly before you post advice?
<URL:http://www.w3.org/TR/html4/struct/links.html>
PointedEars This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: quikquic |
last post by:
Suppose I download a html file with javascript in it, for example,
<html>
<body>
<script language="JavaScript">
document.write("Hello");
</script>
</body>
</html>
|
by: Neil Morris |
last post by:
Hi
I was wondering if there was a way to view the html code that javascript
produced since viewing the source code shows the javascript if statements
for netcrape and IE etc.
thanks
Neil Morris
--
my IE6 favorites for import into Netscape/Internet Explorer
|
by: Rick Spiewak |
last post by:
I need to generate a "buy" button as part of an ASP.NET page - this consists
of a small HTML form with hidden fields, conforming to the requirements of a
merchant credit card processor. PayPal is similar.
I'm succeeding in doing this by using Writer.Write to emit my HTML, at least
as far as getting it to work.
However, depending on where I put MyBase.Render(Writer), I get my HTML
either before the header or after the end of the body of...
|
by: Dave |
last post by:
I have "header.html" used by PERL to construct an entire page.
Unfortunately, this header page contains no head or body tags; the
script generates them. So I am at a loss as to how I can reference 3
external js files to show a js menu in the header page. Nothing I've
tried works and I don't want to monkey with the PERL file. If there is
a way to generate the menu, I'd sure appreciate the code because I'm
only slightly better at javascript...
|
by: Design2d |
last post by:
Hi, if anyone can help with this I'd be very grateful:
I'm generating an html popup window with Javascript. When the popup appears in Explorer 6.0 it is empty and crashes the browser, though it works in Mozilla.
In the generated code I'm linking to a Javascript file "artscripts.js". When I remove this line of code the script works fine (except of course I can't call the javascript functions contained in the linked file).
The first...
| |
by: Chandra |
last post by:
How do I programmatically (javascript) check if link is valid in html?
|
by: ppuniversal |
last post by:
Hi All,
My question is as follows:
I have a text box and two links.Let the two links be - Show and Save .
On clicking the Show , a web page is generated by fetching some data from database according to the input in the textbox and the web page is displayed to the user.
Now on clicking Save also, with the same input to the textbox, the same set of data will be fetched from the database, but in this case I do not want the web page...
|
by: Blackmore |
last post by:
I'd like to screate a link to my javascript functions, such that they do not appear in the page source code and users cannot tamper with them. I've noticed that other websites appear to be able to this usings commands such as:
<SCRIPT src="folder/functions.js" type=text/javascript></SCRIPT>
However, when I try this it does not work. Can anyone explain what I need to do to make this work OR point me in the direction of a suitable tutorial...
|
by: Arsale |
last post by:
I am trying to pass a javascript variable to php on javascript generated page, but on the new page I got only "Array". Where did I go wrong?
On first page, i've got image map with areas. Onmouseover javascript read area names and send it to javascript generated page. On generated page, area name (from first page) need to be query variable (depending of them show data from database). If i put string instead of variable,everything works fine,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |