|
I would recommend that you first use the Java[^] forum for this question. You will most likely have to use some form of BLOB.
|
|
|
|
|
You can use java to serialize the image object and then save it to the database. This link should help
|
|
|
|
|
Please first try search over internet, if you didn't find help then ask to community.
|
|
|
|
|
I made a button in Java Script, and I'm trying to figure out how to turn off the -webkit-appearance so Safari IOS won't turn the button into a rounded button. I found borderRadius.
I want put it inline, instead of modifying the class in the css file, I just need it in one spot.
I looked around but didn't really find anything, most searches produced beginner stuff.
var input_Close = document.createElement("input");
input_Close.id = "_bt_pv_close";
input_Close.type = "button";
input_Close.className = "g-button black";
input_Close.style.width = '112px';
input_Close.style.height = '32px';
input_Close.style.borderRadius = '0';
input_Close.style.fontSize = "1.0em";
input_Close.value = "close";
input_Close.size = "30";
input_Close.onclick = function () { sm_unload_Modal_PhotoViewer(); };
div_Close.appendChild(input_Close);
|
|
|
|
|
Why you are not adding whole style to the object in single line of code!
|
|
|
|
|
I was a complete newbie to writing HTML in the DOM, and I sort of used that style as the next step of advancement.
I couldn't remember the attribute and could not find it through search. I knew there was a one liner for inline style.
I was hoping to keep it the same, but I'll convert to your post example.
Thanks for the reminder!
|
|
|
|
|
Can you please use following:
var div = document.createElement('div');
div.setAttribute('style', 'width:330px; float:left');
|
|
|
|
|
Hi,
I'd like help to complete this script I'm working on. so for it works but I'm strugling to incorporate theremaining three conditions:
1-The same character may not appear more than twice in a row (Kabooom1)
2-Not more than two sequencial alphanumeric characters are permited (Ab123cym)
3-Black list some words like:(Mark, London)
Any help would be appreciated.script as below
=========================================
<script type="text/javascript">
function checkForm(form)
{
if(form.username.value == "") {
alert("Error: Username cannot be blank!");
form.username.focus();
return false;
}
re = /^\w+$/;
if(!re.test(form.username.value)) {
alert("Error: Username must contain only letters, numbers and underscores!");
form.username.focus();
return false;
}
re = /.{8}/;
if(form.pwd1.value != "" && form.pwd1.value == form.pwd2.value)
if(!re.test(form.pwd1.value)) {
alert("Error: Password must contain eight characters Only, Try again!");
form.pwd1.focus();
return false;
}
if(form.pwd1.value !== "" && form.pwd1.value == form.pwd2.value) {
if(form.pwd1.value.length >= 9) {
alert("Error: Password must contain eight characters Only, Try again!");
form.pwd1.focus();
return false;
}
if(form.pwd1.value == form.username.value) {
alert("Error: Password must be different from Username!");
form.pwd1.focus();
return false;
}
re = /[0-9]/;
if(!re.test(form.pwd1.value)) {
alert("Error: password must contain at least one number (0-9)!");
form.pwd1.focus();
return false;
}
re = /[a-z]/;
if(!re.test(form.pwd1.value)) {
alert("Error: password must contain at least one lowercase letter (a-z)!");
form.pwd1.focus();
return false;
}
re = /[A-Z]/;
if(!re.test(form.pwd1.value)) {
alert("Error: password must contain at least one uppercase letter (A-Z)!");
form.pwd1.focus();
return false;
}
} else {
alert("Error: Please check that you've entered and confirmed your password!");
form.pwd1.focus();
return false;
}
alert("You entered a valid password: " + form.pwd1.value);
return true;
}
</script>
<h1 align="center"> Password Validation</h1>
<form ... onsubmit="return checkForm(this);">
<table align="center">
<p>Username:     <input type="text" name="username"size="30"></p>
<p>Password:     <input type="password" name="pwd1"size="30"></p>
<p>Confirm Password:    <input type="password" name="pwd2"></p>
<p><input type="submit"></p>
</form>
=================================
|
|
|
|
|
The same character may not appear more than twice in a row (Kabooom1)
If it matches the regular expression /(\w)\1/ , then you have repeated characters.
Not more than two sequential alphanumeric characters are permitted (Ab123cym)
Not easy with a regular expression. Try something like:
function limitSequentialCharacters(value, limit) {
var sequentialCount = 0;
var prevChar = value.charCodeAt(0);
for (var i = 1; i < value.length; i++) {
var char = value.charCodeAt(i);
if (char === prevChar + 1) {
sequentialCount++;
if (sequentialCount === limit) {
return false;
}
}
else {
sequentialCount = 0;
}
prevChar = char;
}
return true;
}
Blacklist some words like: (Mark, London)
You can either use a regular expression like /^Mark|London$/i , or check the input against a list of blacklisted words.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
You really need to do this in server side code by calling a webservice. Client side validation can always be hacked.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hi All
Can we use java-script/JQuery for interfacing with Hardware device API installed on client system.
Gouranga Das
Software Engineer
|
|
|
|
|
No, that would break the security barrier between a browser and client system.
|
|
|
|
|
Gouranga Das wrote: Can we use java-script/JQuery for interfacing with Hardware device API installed on client system.
The answer is that it depends on what you are doing.
For instance if you are writing application or server side javascript (node.js[^]) then the answer is yes you can do this.
Another example is writing mobile applications written in HTML and javascript for mobile platforms. In this case you can use phonegap[^] which will give you access to certain hardware features of the device.
If you are purely doing web development with pages delivered from a server then the answer will be No (for now) as it violates the sandbox security put in place by the browser.
|
|
|
|
|
Also should have noted that it depends on the browser you are using...
I forgot that with Chrome you can do some stuff with the local hardware. An example is that I have some pinocc.io[^] boards and they are initially configured from a web page that uses chrome features. I have also read some articles in the past where a chrome browser access an arduino[^] via the local USB port.
More info on this feature of Chrome can be found... https://developer.chrome.com/apps/app_serial[^]
|
|
|
|
|
Hi all
Can we use java-script/JQuery for interfacing with Hardware device API installed on client system.
|
|
|
|
|
No. For security purposes browsers will not allow that. Use Java or ActiveX or some other technology that has to be installed on the client machine.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I want to scrape a table from web page but the content of table doesn't exist in the source of page
the table created on the fly by java script
this is the source of page
<HTML>
<HEAD>
<TITLE>Cisco Unified Communications Manager Express GUI</TITLE>
<SCRIPT Language="JavaScript">
GUIVersion = "7.0.0.1 (Compatible with IOS 12.4(20)T)"
var MWinC
var newestDN = 0
var retryTimes = 0
var changeBit = false
var FeedString = new Array()
FeedString[0] = "Router config has been successfully changed."
FeedString[1] = "Configuration has been successfully changed."
FeedString[2] = "Configuration change failed."
FeedString[3] = "Other telnet session active. Write delayed."
var FailReason = new Array()
FailReason[0] = "Please report the following error: "
FailReason[1] = " Ambiguous Command."
FailReason[2] = " No Matched Command."
FailReason[3] = " No Matched Help Command."
FailReason[4] = " No Matched Alias Command."
FailReason[5] = " Config Locked Down Too Long."
FailReason[6] = " Configuration Change is not allowed."
FailReason[7] = " Wrong Tag Value."
FailReason[8] = " System is writing config to memory. Your change is aborted!"
FailReason[9] = " Parser return code failed."
FailReason[10] = " Invalid ITS command option."
var GenFeed = new Array()
GenFeed[0] = "Add the new extension to a new phone?"
function ksBanner() {
MWinC = "<html><head><style>BODY{\n margin-left: 0pt; \n margin-top: 0pt;\n}"
+ "</style><title>Cisco Unified Communications Manager Express</title></head>"
+ "<body><IMG src='logohome.gif' alt='Cisco Logo'>"
+ "</body></html>"
return MWinC
}
function Greet1() {
MWinC = "<html><head><title> View Window </title></head><style>BODY{BACKGROUND-COLOR: #cccccc} H2{PADDING-RIGHT: 0.25em; PADDING-LEFT: 0.25em; FONT-WEIGHT: bold; FONT-SIZE: 0.9em; PADDING-BOTTOM: 0.25em; MARGIN: 0.5em; COLOR: #666699; PADDING-TOP: 0.25em; FONT-FAMILY: Arial, Verdana, Lucida, sans-serif; BACKGROUND-COLOR: #cccccc }</style><body>\n"
+ "<H2>View Window</H2></body></html>\n"
return MWinC
}
function Greet2() {
MWinC = "<html><head><title> Change Window </title></head><body>\n"
+ "<h2>Change Window </h2></body></html>\n"
return MWinC
}
</SCRIPT>
</HEAD>
<FRAMESET rows="0,*" frameborder="0">
<FRAME name="banner" src="ITSMain" scrolling="NO" frameborder="0" marginwidth="0" marginheight="0" noresize>
<FRAME name="dispframe" src="javascript:parent.Greet1()">
</FRAMESET>
</HTML>
however i can get the content of the table from browser developer tools
any suggestions
|
|
|
|
|
You can try using AJAX.
Create an ajax call to a php file with the following code:
getPage.php
<?php
function getPost( $name, $default ){
$value = $default;
if( isset( $_POST[ $name ] ) && $_POST[ $name ] != '' ) {
$value = $_POST[ $name ];
}
return $value;
}
function getSslPage($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
$site = getPost( 'site', '' );
$content = 'empty';
$error = '';
$content = getSslPage( $site );
if( !$content ) {
$error = 'no file found';
}
$arr = array( 'error' => $error, 'htmlResult' => htmlspecialchars($content) );
echo json_encode($arr);
?>
in javascript:
var data = {};
data["site"] = 'http://www.example.com/';
$.ajax({
type: "POST",
url: 'getPage.php',
data: data,
dataType: 'json',
success: function( msg )
{
if( msg['error'] !== '' ) {
alert( 'there was an error: ' + msg['error'] );
}
else {
alert( ' html Found: ' + msg['htmlResult'] );
}
}
});
|
|
|
|
|
How to validate postdate?
|
|
|
|
|
You have to be much more specific to get any answers - it's just not a question despite the question-mark...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
You can validate date with split the date into some part.
modified 9-Sep-14 7:49am.
|
|
|
|
|
what???Give some more clarity of what you ask buddy!.
|
|
|
|
|
I have a dropdown and multiple gridviews in the page .And on the basis of value selected from dropdown, data is loaded in Gridviews. And each gridview has linkbutton in each row, on click of which modal popup opens.
I want gridviews to be collapsed on dropdown select index change.
but my javascript function is not getting called.
And getElementByTagName('tr') is not working in internet explorer.
This is my Grid:
<asp:GridView ID="gvBillCalc" runat="server" AutoGenerateColumns="False" BorderColor="#CCCCCC"
BorderStyle="None" BorderWidth="1px" CellPadding="3" Font-Bold="True" GridLines="Vertical"
Font-Size="Small" EmptyDataText="No Data Found" Width="100%" OnRowDataBound="gvBillCalc_OnRowDataBound"
BackColor="WhiteSmoke">
<Columns>
<asp:TemplateField>
<HeaderStyle Width="25px" />
<ItemStyle Width="25px" BackColor="White" />
<HeaderTemplate>
<asp:Image ID="imgTab" onclick="javascript:Toggle();" runat="server" ImageUrl="../Images/plus.gif"
ToolTip="Expand" />
</HeaderTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Item Particular">
<ItemTemplate>
<asp:Label ID="lbDesc" Text='<%#Eval("desc")%>' runat="server"></asp:Label>
<asp:HiddenField ID="hdnID" runat="server" Value='<%#Eval("id") %>' />
</ItemTemplate>
<HeaderStyle Font-Size="14px" />
<ItemStyle Font-Size="12px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Amount(In Rs.)">
<ItemTemplate>
<asp:Label ID="lbAmt" Text='<%#Eval("total")%>' runat="server"></asp:Label></ItemTemplate>
<HeaderStyle Font-Size="14px" />
<ItemStyle Font-Size="12px" HorizontalAlign="Right" />
</asp:TemplateField>
<asp:TemplateField HeaderText="View/Edit">
<ItemTemplate>
<asp:LinkButton ID="lbViewEdit" runat="server"></asp:LinkButton>
<asp:HiddenField ID="hdnViewEdit" runat="server" Value='<%#Eval("flag") %>' />
</ItemTemplate>
<HeaderStyle Font-Size="14px" />
<ItemStyle Font-Size="12px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Remarks">
<ItemTemplate>
<asp:Label ID="lbRemark" Text='<%#Eval("Remarks")%>' runat="server"></asp:Label></ItemTemplate>
<HeaderStyle Font-Size="14px" />
<ItemStyle Font-Size="12px" />
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="White" ForeColor="#000066" />
<RowStyle ForeColor="#000066" />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
<EmptyDataRowStyle BackColor="#FFC0C0" Font-Bold="True" Font-Size="X-Small" />
</asp:GridView>
This is my javascript:
var Grid = null;
var UpperBound = 0;
var LowerBound = 1;
var Grid1 = null;
var UpperBound1 = 0;
var LowerBound1 = 1;
var CollapseImage = '../Images/minus.gif';
var ExpandImage = '../Images/plus.gif';
var CollapseImage1 = '../Images/minus.gif';
var ExpandImage1 = '../Images/plus.gif';
var IsExpanded = true;
var IsExpanded1 = true;
var Rows = null;
var Rows1 = null;
var n = 1;
var n1 = 1;
var TimeSpan = 25;
var TimeSpan1 = 25;
window.onload = function () {
Grid = document.getElementById('<%= gvBillCalc.ClientID %>');
UpperBound = parseInt('<%= this.gvBillCalc.Rows.Count %>');
Rows = Grid.getElementsByTagName('tr');
}
function Toggle() {
debugger;
var Image = this;
ToggleImage(Image);
ToggleRows();
}
function ToggleImage(Image) {
if (IsExpanded) {
Image.src = ExpandImage;
Image.title = 'Expand';
Grid.rules = 'none';
n = LowerBound;
IsExpanded = false;
}
else {
Image.src = CollapseImage;
Image.title = 'Collapse';
Grid.rules = 'cols';
n = UpperBound;
IsExpanded = true;
}
}
function ToggleRows() {
if (n < LowerBound || n > UpperBound) return;
Rows[n].style.display = Rows[n].style.display == '' ? 'none' : '';
if (IsExpanded) n--; else n++;
setTimeout("ToggleRows()", TimeSpan);
}
This is Code Behind:
protected void ddlNodeName_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddlNodeName.SelectedItem.Value != "0")
{
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "CallMyFunction", "Toggle();", true);
Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "Toggle()", true);
ClientScript.RegisterStartupScript(GetType(), "CallMyFunction", "Toggle();", true);
}
else
{
}
}
|
|
|
|
|
This[^] article has the sample on how you can use client side event. Also, it has sample on collapsing grid rows which might help you.
Life is a computer program and everyone is the programmer of his own life.
|
|
|
|
|
Can we do something with this forum software? When you switch between messages using the keyboard it would be nice to lock the message position. It would be pretty easy to add that functionality. Do you want me to do it?
Fever
|
|
|
|