|
Look at JQuery, particularly the toggle[^] method.
JQuery is also cross-browser compatible so you won't need the all of the tedious, error prone code above to support multiple browsers.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Personally, I would forget about Netscape users. Anypme that still uses Netscape 4 gets what they deserve.... And while JQuery is good, it won't help you understand anything, and IMHO is a bit like using a sledgehammer to crack a nut, in this scenario anyway.
The following will work in most browsers - you won't get too many complaints. NB, you don't, of course, need to pass the element ID's as variables to the toggle function, but could hard-code them within - but doing so makes it more generic for use elsewhere, or with more than one such show/hide link on the same page.
<html>
<head>
<title></title>
<script language="javascript">
function toggleDiv(d, h) {
var div = document.getElementById(d);
var lnk = document.getElementById(h);
if (div.style.display == 'none') {
div.style.display = 'inline';
lnk.innerHTML = 'Hide';
} else {
div.style.display = 'none';
lnk.innerHTML = 'Show';
}
}
</script>
</head>
<body>
<form id="form1" >
<div><p><a href="#" id="lnk" onclick="toggleDiv('fred','lnk')">Show</a></p></div>
<div id="fred" style="display:none;">Now you see me</div>
</form>
</body>
</html>
|
|
|
|
|
Dot't use
style.visibility = 'visible'
use
style.display = 'none'
Rating always..... WELCOME
Be a good listener...Because Opprtunity Knock softly...
|
|
|
|
|
Hi..
can i send email via javascript.
how would i eliminate further input popup boxes which appear at submitting email.
(popups like smtp settings and email id etc)
thanks,
hemant
By:
Hemant Thaker
|
|
|
|
|
|
Hi All,
I am facing a problem in my application and need you guys help. The problem is to I want to close all the pop-up windows if user click on log out link or id user directly close the browser. I need to perform all this with the help of JavaScript. Is any one can please help me to solve this? One constraint is that I can not change existing modules.
Thanks a lot in Advance.
Thanks,
RK...
|
|
|
|
|
RajinderKamboj wrote: I can not change existing modules
If you can't make any changes then how are you going to do anything?
The first thing would be to redesign and not use popups. Otherwise you'll need to keep track of windows that are opened and close them during log out or on the close event of the main window
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi Mark,
Thanks for reply. I mean of not change existing modules means I can not change each and every program which is opening the pop-up. I can change some of main programs. Can you please give me soluation for this?
Thanks a lot once again.
Thanks,
RK..
|
|
|
|
|
InderK wrote: Can you please give me soluation for this?
There is no solution if you don't have control over the apps that are opening the windows
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
IS there any way to find out the URL of all opened browsers? Please reply.
Thanks a lot.
RK..
|
|
|
|
|
If you are opening the popup using a common function, then only you can track the windows and close all the popup windows if user clicks on logout.
|
|
|
|
|
Hi,
Greetings everyone!
In my web application in a certain form, I want to show help text for some of the labels. The codes are as following:
<dt style="position:relative;">Pathway<a href="#"><img src="Images/1280835207_information-balloon.png" alt="" border="=0" id="show" onmouseover="showDiv('show');" onmouseout="hideDiv('show','wrapper');" /></a>
<div id="wrapper" style="width:275px; position:absolute; left:180px; " >
<div style="background:url(Images/div_head.png) no-repeat ; width:275px; height:60px;"></div>
<div style="background:#d8d7d3; width:263px; padding:4px; border-left:2px solid #f39716;border-right:2px solid #f39716">hjgfdhfhhh hhhhhhh hhhhhhhh ghhghgj jhjuvhfgf hjfkdg hkijdkf hgtjnglk.</div>
<div style="background:url(Images/div_bot.png) no-repeat; width:275px; height:19px;">
</div>
</div>
</dt>
And the javascript is as follows :
<script type="text/javascript">
function hideDiv(sh,wr)
{
document.getElementById(sh).style.display = '';
document.getElementById(wr).style.display = 'none';
}
function showDiv(wr)
{
document.getElementById(wr).style.display = '';
}
</script>
The problem is that this help text will be shown for some more labels in the same page. You can see that I'm maintaining the position of the help-text div by maintaining it's left position :
position:absolute; left:50px;
So when the label-text is larger then this position will not be applied. Is there a way to dynamically maintain the left position? I mean to say for larger or smaller label-text the position of the help-div will be adjusted automatically. I'm not sure whether I'm successful in making my need clear. Can anyone please help me?
Thanks in advance.
|
|
|
|
|
Pass image object refrence in showdiv fn
onmouseover="showDiv(this,'wrapper');"
And set the left position dynamically
function showDiv(obj,wr) {
document.getElementById(wr).style.left = obj.offsetLeft + 'px';
document.getElementById(wr).style.display = '';
}
|
|
|
|
|
Hi guys.
How can i check Wheather file exist in paricular location or not
i saw some example but its not working.
Your answer would be helpful for me... Thanks
Shafiq
|
|
|
|
|
TRY it out
function CheckFile()
{
var fso = new ActiveXObject("Scripting.FileSystemObject");
FileExist = fso.FileExists("TEST.txt");
if (FileExist == true){
alert("True")
}
else
{
alert("FAIL");
}
}
Rating always..... WELCOME
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
Hey koolprasad
Thanks for reply. I already tried this it works only in case of IE (after change security setting in internet option Activexcontrol safe enable=enable which is not safe) and in another browser its not working...
what i am missing or what i need to do to work in all browser, without change in setting becouse client is not going to change in setting.
please share ur Idea
Thanks...
Shafiq
|
|
|
|
|
You can not access client file, unless you use Activex and give special permission. Just think what could happen if javascript are allowed to access client files.
|
|
|
|
|
Hello Friends
I created one msi file and running it in browser.Now when next time I run the browser I want to check that .msi file installed or not through java Script So only I can show up in Browser to install or not.
Thanks In Advance.
Regards
Yogesh
|
|
|
|
|
|
Hello Sir
Thank You nery much for ur reply.
Can U make it little more elaborate that how I can use property of .msi in java script try catch.
As I created that .msi using c#.
I will be very thankful to you.
Regards
Yogesh
|
|
|
|
|
the .msi would need to insall a scriptable "plug-in"
|
|
|
|
|
Hello Sir
I am new to c#.can you please provide me some link or some way where i can check how to install scriptable plugin with MSI?
Thanks & Regards
Yogesh
|
|
|
|
|
Hello devey
I will be very please to you If u provide me some idea how to install scriptable plugin with msi and how will i detect in java script and will that work for each browser?
I will be very thankful to you.
Thanks & Regards
Yogesh
|
|
|
|
|
http://www.codeproject.com/KB/aspnet/AspxProtocol.aspx
http://www.codeproject.com/KB/shell/MouseGestures.aspx
http://www.codeproject.com/KB/cross-platform/NPAPIBrowserPlugin.aspx
http://www.codeproject.com/KB/shell/dotnetbandobjects.aspx
|
|
|
|
|
Hello Sir
Thanks a lot for ur Information.I will look into this to make it workable.
Regards
Yogesh
|
|
|
|