473,753 Members | 6,868 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help sought for browser button

Hello group.

This is my first message in this group, and my first stab at
Javascript.

I am trying to tweak the code for the "FOLDOC button"
(http://foldoc.org/foldoc/tools.html) to be able to execute a DB query
over my firm's intra-net.

The source code for the IE button is as follows:

javascript:f=do cument.frames.l ength;q=(f?'':d ocument.selecti on.createRange( ).text);for(i=0 ;i<document.fra mes.length;i++) {q=document.fra mes[i].document.selec tion.createRang e().text;if(q!= '')break;}if(q= ='')void(q=prom pt('search
foldoc:',''));i f(q!=null){q='h ttp://www.foldoc.org/?'+escape(q);vo id(f?open(q):wi ndow.location=q )}

which when reasonably indented looks like this:

javascript:
f=document.fram es.length;
q=(f?'':documen t.selection.cre ateRange().text );
for(i=0; i<document.fram es.length; i++)
{
q=document.fram es[i].document.selec tion.createRang e().text;
if(q!='')
break;
}
if(q=='')
void(q=prompt(' search foldoc:',''));
if(q!=null)
{
q='http://www.foldoc.org/?'+escape(q);
void(f?open(q): window.location =q)
}

For reasons I don't understand, IE *requires* that the entire code be
in one single line. Notwithstanding that, the FOLDOC button works
quite well.

My tweak to the FOLDOC code attempts to do this:
* In either the selected text, or the text entered in the 'Prompt'
box,
* Strip off all text EXCEPT,
* numbers of 5 or more digits.

For example, when a text such as

In v6.1.25.4 release, defects 12345, 23456, 78901 and 24211 were fixed
on 4/5/6. Docs are available at ftp://12.34.56.78/TR34251.txt

is selected (or copy-pasted), the string should be reduced to

12345,23456,789 01,24211,34251

before appending it to my query URL.

My attempt is as follows (I have laid it out indented and spread out
although the IE button code has it all in one single line):

f=document.fram es.length;
q=(f?'':documen t.selection.cre ateRange().text );
for(i=0; i<f; i++)
{
q=document.fram es[i].document.selec tion.createRang e().text;
if(q!='')
break;
}
if(q=='')
void(q=prompt(' Search for Defect ID:',''));
if(q!='' && q!=null)
{
q=q.replace(/\D+/g,'#');
q=q.replace(/\b\d{1,4}#/g,'#');
q=q.replace(/#+/g,',');
q=q.replace(/(^\,|\,$)/gm,'');
q='http://intranet.myfirm .com/query.asp?JTSNo ='+escape(q);
}
else
q='http://intranet.myfirm .com';
void(f?open(q): window.location =q);

The problem is, when I click the button (for this code), NOTHING
happens.

Some observations:
* I use IE 6.0.2900 on XP SP2 (includes all current patches/security
fixes).
* I have UNCHECKED the "Disable script debugging" option as well as
CHECKED the "Display notification on every script error".
* I've tried installing Microsoft script debugger.
* The above code reduced to a single line is well within the 2083
character limit.

None of them have any effect, i.e., IE does not seem to think there is
any error. It simply just does not do anything.

The help I seek:
* Is there anything wrong with the code above? Is there any better way
to do what I have sought to do?
* Can anyone explain why nothing happens, yet another button with near
identical code works flawlessly?
* In general, how do I debug such code?

All advice/insights appreciated,
- Anand Hariharan

Feb 8 '06 #1
3 1460
VK

ma************* *******@gmail.c om wrote:
For reasons I don't understand, IE *requires* that the entire code be
in one single line. Notwithstanding that, the FOLDOC button works
quite well.
javascript: pseudo-protocol is still *protocol* so should follow the
URL schema where line breaks are not allowed unless escaped.
q='http://intranet.myfirm .com/query.asp?JTSNo ='+escape(q);
}
else
q='http://intranet.myfirm .com';
void(f?open(q): window.location =q);

The problem is, when I click the button (for this code), NOTHING
happens.

Some observations:
* I use IE 6.0.2900 on XP SP2 (includes all current patches/security
fixes).
* I have UNCHECKED the "Disable script debugging" option as well as
CHECKED the "Display notification on every script error".
* I've tried installing Microsoft script debugger.
* The above code reduced to a single line is well within the 2083
character limit.

None of them have any effect, i.e., IE does not seem to think there is
any error. It simply just does not do anything.

The help I seek:
* Is there anything wrong with the code above? Is there any better way
to do what I have sought to do?
* Can anyone explain why nothing happens, yet another button with near
identical code works flawlessly?
* In general, how do I debug such code?


Create a test page and place your code as a normal JavaScript function
(so line breaks between statements are OK). Call this function on
button click. Place alert() in different places (starting from the
function first line) to see where the execution breaks or even if it
starts at all.

Feb 8 '06 #2

VK wrote:
ma************* *******@gmail.c om wrote:
For reasons I don't understand, IE *requires* that the entire code be
in one single line. Notwithstanding that, the FOLDOC button works
quite well.


javascript: pseudo-protocol is still *protocol* so should follow the
URL schema where line breaks are not allowed unless escaped.


Thanks for the response, VK.

If by 'escaping' you mean ending each line with a back-slash, tried
that and that does not work (IE reports invalid character).

Some observations:
* I use IE 6.0.2900 on XP SP2 (includes all current patches/security
fixes).
* I have UNCHECKED the "Disable script debugging" option as well as
CHECKED the "Display notification on every script error".
* I've tried installing Microsoft script debugger.
* The above code reduced to a single line is well within the 2083
character limit.

None of them have any effect, i.e., IE does not seem to think there is
any error. It simply just does not do anything.

The help I seek:
* Is there anything wrong with the code above? Is there any better way
to do what I have sought to do?
* Can anyone explain why nothing happens, yet another button with near
identical code works flawlessly?
* In general, how do I debug such code?


Create a test page and place your code as a normal JavaScript function
(so line breaks between statements are OK). Call this function on
button click. Place alert() in different places (starting from the
function first line) to see where the execution breaks or even if it
starts at all.


Like I said, I am new with Javascript, and I admit I do not know how to
"".

I did put alert at a number of places (even at the first line) - as I
said NOTHING happens (i.e., nothing gets executed ever).

However, when I removed the 'replace' calls, it works and has the
semantics of the FOLDOC button (i.e., whatever text entered or selected
is appended to the query). So, the code that I put in for
pre-processing the input seemingly causes some parse problems for IE?

NB: The code, the intention behind my pre-processing is all in my
original post. I can reproduce them again if you'd like.

best wishes,
- Anand

Feb 8 '06 #3

mailto.anand.ha riha...@gmail.c om wrote:
VK wrote:
ma************* *******@gmail.c om wrote:

Create a test page and place your code as a normal JavaScript function
(so line breaks between statements are OK). Call this function on
button click. Place alert() in different places (starting from the
function first line) to see where the execution breaks or even if it
starts at all.


Like I said, I am new with Javascript, and I admit I do not know how to
"".


Sorry about that. I meant to say 'I do not know how to Call this
function on a button click'.

Feb 8 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
2713
by: brendan | last post by:
Sorry this isnt a cross post .. i just didnt get any help from alt.php. I have a website which utilises post forms for navigation in some areas. Problem is, when *some* users hit the BACK button the POSTDATA content has expired and they need to refresh the page then they get a alert about refreshing expired data. I am getting complaints that this is too annoying and limits the sites useability.
1
2516
by: Jenny | last post by:
Need urgent help for an unsolved problem. In our ASP web application, we creat a Back button and if user click on this button, it execute history.go(-1) to go back to the previous page. All our users use IE 6.0 and most of them don't have problem with this button. But one user reported everytime he click on this button, there is a pop-up window shows up and ask him refresh and reload the page, after he clicks OK, the previous page will be...
8
3393
by: DKM | last post by:
Here are the source code files to a Java applet that utilizes LiveConnect to communicate with Javascript, and the HTML file. The thing works both in IE 6.0 and FireFox 1.4. but with some problems. IE crashes when one refreshes the page or leave the page. This happens only after calling the Java method more than once. It does not crash if the Java method is called just once and then the page is refreshed. FireFox does not crash at all...
1
1977
by: Michael D. Reed | last post by:
I am using the help class to display a simple help file. I generated the help file using Word and saving it as a single page Web page (.mht extension). I show the help file with the following statement. Help.ShowHelp(Parent:=Me, url:=Me.HELP_URL_PRE & Me.myWorker.HelpFile) How do I get it to go away when the program exits? Now when I quit the program that I called it form the help file is sill displayed. Is there a way to get a handle...
2
1987
by: Steve K | last post by:
I got a bit of a problem I like some help on. I'm designing an online training module for people that work in food processing plants. This is my target audience. These workers have little or no computer knowledge at all! And they also have outdated, old browsers, slow modems, old computers, etc. So I need to keep this as simple as possible and as browser compatible as possible. The client wants a navigation bar at the bottom of each...
8
2086
by: pamelafluente | last post by:
I am beginning aspNet, I know well win apps. Need a simple and schematic code example to start work. This is what I need to accomplish: ---------------------- Given button and a TextBox on a web form when one presses the button on the web form on a client pc, the sql query which is contained in the text box is sent to a vb net application on a server pc. The win application sends the query to the database, collects the results,
0
2519
by: toeffetommy | last post by:
Hello, I need a piece of functionality developed for our Website and I need some technical advice on how get there. Essentially, what I want to develop is a browser-within-browser functionality where the ‘mini-browser’ has similar functionality to a normal browser. Let me explain: Firstly, our website interface will open up in a popup window. All the normal browser toolbars and buttons have been removed from the popup window. It’s...
0
5573
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
8
2049
by: Richard Maher | last post by:
Hi, I am in a mouseup event for button A and I'd like to disable=false button B before starting some work. Is there anyway that an event for button B can then fire before my event processing for button A's mouseup has completed? I beleive event processing to be single-threaded for good reason but I need a "stop" button and it's no good if it doesn't do anything until the other processing has finished :-)
0
9072
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8896
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,...
0
9653
Oralloy
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...
1
9421
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,...
0
8328
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6151
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4771
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...
0
4942
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2872
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.