Search google for text entered in an input field [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm looking to make a Google search bar for a website I am creating. I would like to search Google for the text entered in an <input> tag. Any help would be greatly appreciated.

Try something like this
<script>
function googleSearch()
{
var text=document.getElementById("search").value;
var cleanQuery = text.replace(" ","+",text);
var url='http://www.google.com/search?q='+cleanQuery;
window.location.href=url;
}
</script>
<input type="text" id="search" />
<button onclick="googleSearch();">Search</button>

Related

how to display an alert if the file size or extension is not correct [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I have a form to send images, it works perfectly. But how to display an alert if the size or the extension of the file is not correct, or verify that it is indeed an image. I give you the code for my button.Thank you for help
<button type="button" name="photo" value="Upload" onclick="submitUploadFileForm()" class="btn btn-primary btn-lg" style="width: 100px;height: 50px;color: #FFF;">Envoyer</button>
Type : just add accept attribue in the input field (can save you to do test about the extension)
Size : in the submitUploadFileForm() function do this test : if(document.getElementById("inut id").files[0].size > x){ alert(check the size) return }

trying to implement a js color picker that changes the background of a html5 document [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
<script src="jscolor.js"></script>
var Color: <input class="jscolor" value="ab2567">
<script>
colorObject.value=#Color;
colorObject.value
document.body.style.backgroundColor==(Color)
</script>
here is the file jscolor.js, https://www.dropbox.com/s/qmvy2vzmin3z01h/jscolor.js?dl=0
Any help is much appreciated, thanks!
You need add event listener to do that.
See my snippet below:
function changeColor() {
var jsColor = document.getElementsByClassName('jscolor')[0];
document.body.style.backgroundColor = '#' + jsColor.value;
}
<script src="http://jscolor.com/release/latest/jscolor.js"></script>
<input class="jscolor" value="ab2567" onchange="changeColor()">

Changing link to pop up link [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Hello trying change this link ;
<span style="float:right;min-width:210px;"></span>GİRİŞ<br /><br />
To This ;
<a href="#" onclick="javascript: window.open('http://www.koltukcubey.com/chat/index.php?project=24&member=2', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=1046,height=520'); return false" >Chat sistemine git</a>
Because you did not include the window.open part !
This should work fine.
Thirdt

Edit a disabled input field with javascript [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have a disabled field that I want to edit with the below script
<html>
<select id="country"onchange="changeCountryCode()">
<input type="text" disabled id="cc">
<script>
function changeCountryCode()
{
var temp = $('country').val();
$('cc').val(temp);
}
</script>
</html>
It's not working for me.
What you have almost works but you are missing the # in your selectors. The # sign tells jQuery to use the ID attribute when looking up the element desired.
Should be:
var temp = $('#country').val();
$('#cc').val(temp);

Using a javascript string variable like a DOM object [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
i want to know if i can use a string variable in javascript, like this:
var str =
'<html>
<head>
<title>Status page</title>
</head>
<body style="font-family: sans-serif;">
<p style="font-size: 1.2em;font-weight: bold;margin: 1em 0px;">Forbidden</p>
<p>Attempting to finish {Interaction5e8d4072-6b49-4e69-b084-1d8e741f4f10.habla}, an interaction without cleaned dependencies</p>
<p>You can get technical details here.<br>
Please continue your visit at our
home page.
</p>
</body>
</html>';
like a DOM object and how.
Thanks!
Yes you can, should you if the real question.
var str = '<p>Some paragraph</p>';
document.write(str); // Or
document.getElementById('id').innerHTML(str);

Categories

Resources