vbscript onload legacy code - html

I know this question has been answered a million times over, over 2 decades or so however, I have legacy code (by that I mean old code that has been around for decades written in classic asp) and it uses a vbscript onload function and it works fine. However when I try to replicate (cut down version) myself it does not work can somebody direct me to the official answer. My code is in the same folder as the legacy code. I have also modified the legacy code and it still works so it cannot be caching.
I tried and all give me an error:
startup
startup;
startup()
startup();
vbscript:startup()
vbscript:startup();
I tried also, but no error but no result
vbscript::startup()
vbscript::startup();
My code:
<html>
<head>
<title>TEST</title>
<script language="vbscript">
Sub startup()
f1.browser.disabled = True
End Sub
</script>
</head>
<body onLoad="vbscript::startup()">
<form name="f1">
<input list="browsers" name="browser">
<datalist id="browsers">
<option value="Internet Explorer">
<option value="Firefox">
<option value="Chrome">
<option value="Opera">
<option value="Safari">
</datalist>
<input type="submit">
</form>
<p><b>Note:</b> The datalist tag is not supported in Safari or IE9 (and earlier).</p>
</body>
</html>
If I change it to JavaScript it does work as everyone else seems to suggest however WHY DOES MY LEGACY CODE WORK!!!
Without submitting the hole page can someone suggest something.

Recently I have solved very similar problem and found on this reliable web site:
Specifying legacy document modes
following solution: using x-ua-compatible header.
<html>
<head>
<!-- Use Internet Explorer 9 Standards mode -->
<meta http-equiv="x-ua-compatible" content="IE=9">
<title>My webpage</title>
</head>
<body>
<p>Content goes here.</p>
</body>
</html>

Related

Why do HTML dropdown selections sent in the form of an email look so unreadable

I'm working on an automated shopping list using HTML only. I've figured out a way to send the dropdown selections to an email draft. I wanted to know why the HTML dropdown selections look bad once they reach the email draft.
As you can see in the screenshot, the dropdown selections made are stored in a non-plaintext form. That is, the special characters like the +, & make it look really unreadable. How do you change that?
So instead of flour brand = Option A, or something like that, it says flour+brand=OptionA
And instead of separating flour brand and weight with a comma or a newline, it says flour+brand=OptionA&flour+weight=5kg or something like that.
How do I make the draft more readable by getting rid of unnecessary characters, etc.?
I'm really sorry, but honestly, I don't know any other way of expressing myself. I hope the screenshot helps. I'd highly appreciate an edit for this question's title and stuff.
If possible, do help out.
Code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">
</head>
<body>
<h1>Automated Shopping List</h1>
<form action="mailto:recipient#gmail.com" method="post">
<label for="flour brand">Flour Brands:</label>
<select name="flour brand" id="flour">
<option value="OptionA">OptionA</option>
<option value="OptionB">OptionB</option>
<option value="OptionC">OptionC</option>
</select>
<select name="flour weight" id="flour">
<option value="1kg">1kg</option>
<option value="2kg">2kg</option>
<option value="3kg">3kg</option>
<option value="4kg">4kg</option>
<option value="5kg">5kg</option>
</select>
<br>
<label for="sugar weight">Sugar Weight:</label>
<select name="sugar weight" id="sugar">
<option value="1kg">1kg</option>
<option value="2kg">2kg</option>
<option value="3kg">3kg</option>
<option value="4kg">4kg</option>
<option value="5kg">5kg</option>
</select>
<br>
<input type="submit" value="Send Email" />
</form>
</body>
</html>
Try encoding your form as plain text:
<form action="mailto:recipient#gmail.com" method="post" enctype="text/plain">
https://www.w3schools.com/tags/att_form_enctype.asp

Simple AngularJS Script Works in Chrome but fails in IE11

I have a simple AngularJS (v1.3.0-rc.1) page (see below) from the book, Learning AngularJS for .NET Developers (Packt Publishing) page 13, that works in Chrome, but fails to pickup the <span title="{{color}}" style="background-color:{{color}};"> </span> correctly in IE11. The F12 option in IE shows the style is not being picked up, <span title="magenta"> </span>. What can the problem be in IE11?
<!DOCTYPE html>
<html ng-app>
<head>
<meta charset="utf-8" />
<title>Chapter 1 Example - AngularJS</title>
<script src="Scripts/angular.js"></script>
</head>
<body>
<h1>Introduction</h1>
<label>My name:</label>
<input type="text" placeholder="Please enter name" ng-model="name" />
<br />
<label>My favorite color:</label>
<select ng-model="color">
<option>Please select</option>
<option>red</option>
<option>yellow</option>
<option>magenta</option>
</select>
<h3 ng-show="name">Hello! My name is {{name}}.</h3>
<h3 ng-show="color">My favorite color is <span title="{{color}}" style="background-color:{{color}};"> </span></h3>
</body>
</html>
This is probably failing because the browser is attempting to apply styles before AngularJS has gotten ahold of the string and replaced {{color}} with whatever value is being set.
Angular offers some angular-specific attributes to handle this discrepancy (ng-style, ng-href, etc).
Try replacing that span with:
<span title="{{color}}" ng-style="{'background-color':color}"> </span>
I had to use ng-attr-style.
<div ng-attr-style="width: {{value}}%"></div>
Here is a github discussion about this issue.
Here is a stackoverflow question which has more solutions.

HTA back button not working

Back button on the below code is not working. When I click back, its not coming to previous page. Can anyone suggest how can I make it work? Thanks for your suggestions. I tried a lot to check everything possible. I didn't get this one working.
<html>
<head>
<title>Title</title>
<HTA:APPLICATION ID="Main"
APPLICATIONNAME="Main Application"
BORDER="thin"
BORDERSTYLE="normal"
CAPTION="yes"
CONTEXTMENU="no"
ICON=""
SHOWINTASKBAR="no"
SINGLEINSTANCE="yes"
SYSMENU="yes"
NAVIGABLE="yes"
MAXIMIZEBUTTON="no"
MINIMIZEBUTTON="no" />
<script language="VBScript" type="text/vbscript">
function doValidation()
dbalias=frmMyForm.test.Value
IF len(dbalias)=0 then
document.writeln("Please select the Environment and Try again")
doValidation=False
document.writeln("<br><tr><td nowrap align=Center colspan=2><input type=button value=Back name=ClickBack onclick=history.back()></td></tr>")
End if
End function
Sub cmdSubmit_OnClick
if (doValidation()) Then
dbalias=frmMyForm.test.Value
MGSBOX DBALIAS
End if
End Sub
</script>
</head>
<body bgcolor="#E6E6FA">
<h1 align="center"><font face="Times Roman" color="blue">Title</font></h1>
<form action="temp3.php" name="frmMyForm" id="frmMyForm" method="post">
<fieldset>
<label>* Select the Test </label>
<select name="test" id="test">
<option value="" selected></option>
<option value="test1">Test1</option>
<option value="test2">Test2</option>
<option value="test3">Test3</option>
</select>
<br>
<input type="button" name="cmdSubmit" id="cmdSubmit" value="Submit" style="height:25px; width:60px">
</fieldset>
</form>
</body>
</html>
According to this horse's mouth, a .HTA does not support a history. That seems plausible, as a .HTA lacks IExplorer's chrome/gui. The link provides a JScript implementation that could be ported to VBScript, although #Teemu's concerns should be dealt with first.
Update wrt Teemu's comment:
Another mouth mentioning problems with history - on IE 10. So maybe it is a version thing. Interestingly, this horse switched to IE kiosk mode; perhaps that could be another way of solving the OT's real world problem.

<progress> Object not Displaying in HTA (with IE11 Install)

Pretty basic question, can someone tell me why the example code for the progress bar element would work fine in all three browsers (most importantly IE), but just doesn't appear in an HTA? Am I going to need to find a different way to inject a progress bar?
<html>
<head><title>Generic Title</title>
<HTA:APPLICATION
ID="planner"
APPLICATIONNAME="Progress Bar Test"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="auto"
CAPTION="yes"
BORDER="thin"
BORDERSTYLE="raised"
>
</head>
<body>
<progress value="22" max="100"></progress>
</body>
</html>
Well it wasn't an IE8 compatibility, but you did help me answer it since I didn't realize IE9's HTML5 support is pretty terrible as well. I updated to IE=11 instead and it seems to work fine now.
Thanks!

HTML to customize a product

I am looking to create a customizable product that you can change and see the visual changes on the site. I'm finding this hard to explain, so I apologize if you immediately know of a tutorial for this. I'm just at a loss of how to really explain this idea.
http: //bit. ly/L8DfF2
On the page it shows the product they sell, a custom xbox 360 controller, can someone point me in the right direct of how to create a custom product page with this idea.
Just glancing at the source it looks like obviously drop down lists with each option connected to a picture that changes a certain component of the product. But is there anything else more to it? I'm use to connecting listed or bulletined options to links, do I just simply connect it to the picture? Just not sure how to set up a product to display the updated options you can select is my biggest question.
Well it's the base image, and then on top of it is a stack of empty images. As you change the settings, each has some onChange listener, that changes the src or one of those empty images...thereby changing the overall stacked image.
Here is some sample code on the concept...in your implementation each select would adjust a different image (that represents just the relevant piece of the product):
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
#shell {width:100px;height:100px;display:block; background-color:#f00;}
#button {width:50px;height:50px;display:block; background-color:#00f;}
</style>
</head>
<body>
<div id="shell"><div id="button"></div></div>
Shell:
<select onChange="col('shell',this.value)">
<!-- in your version the values below would be file names of images -->
<option value="#f00">Red</option>
<option value="#0f0">Green</option>
<option value="#00f">Blue</option>
</select><br/>
Button:
<select onChange="col('button', this.value)">
<!-- in your version the values below would be file names of images -->
<option value="#00f">Blue</option>
<option value="#f00">Red</option>
<option value="#0f0">Green</option>
</select>
<script>
function col(part,x){
document.getElementById(part).style.backgroundColor=x;
//in yours, it would be document.getElementById(part).src=x;
}
</script>
</body>
</html>